const request = require("request");

// 要访问的目标页面
const targetUrl = "https://httpbin.org/ip";

// 代理服务器
const proxyHost = "ng001.weimiaocloud.com";
const proxyPort = 9003;

// 代理隧道验证信息，订单对应处查看
const proxyUser = "0Nuygy3***L5f9f";
const proxyPass = "zRIMm***Qu97gw";

const proxyUrl = "http://" + proxyUser + ":" + proxyPass + "@" + proxyHost + ":" + proxyPort;

const proxiedRequest = request.defaults({ 'proxy': proxyUrl });

const options = {
  url: targetUrl,
  headers: {
    "Proxy-Switch-Ip": "yes"
  }
};

proxiedRequest
  .get(options, function (err, res, body) {
    console.log("got response: " + body);
  })
  .on("error", function (err) {
    console.log(err);
  })
  ;  